package com.xlf.service.judge.io.impl;

import cn.hutool.core.lang.Assert;
import com.xlf.service.judge.io.Resource;
import com.xlf.service.judge.io.ResourceLoader;
import com.xlf.pojo.base.Problem;


/**
 * 加载该题目的默认策略
 */
public class DefaultResourceLoader implements ResourceLoader {


    @Override
    public Resource getResource(Problem problem) {

        Assert.notNull(problem, "problem must not be null");
        Integer test_case_source = problem.getTestCaseSource();
        if(test_case_source == null || test_case_source == 0)
            return new MysqlResource(problem.getId());
        return new FileResource(problem.getId());
    }

}
